<template>
  <el-select v-bind="$attrs" :clearable="clearable">
    <el-option
      v-for="item in options"
      :key="item[valueKey]"
      :label="item[labelKey]"
      :value="item[valueKey]"
    ><slot :item="item"></slot>
    </el-option>
  </el-select>
</template>

<script lang="ts" setup name="commonSelect">
interface Props {
  options: any[];
  labelKey?: string;
  valueKey?: string;
  clearable?: boolean;
}

withDefaults(defineProps<Props>(), {
  options: () => [],
  labelKey: 'label',
  valueKey: 'value',
  clearable: true
});
</script>
